﻿using UnityEngine;
using System.Collections;
using System;

namespace Hont
{
    public class GameDateStandard
    {
        static GameDateStandard mInstance;
        public static GameDateStandard Instance
        {
            get
            {
                if (mInstance == null)
                    mInstance = new GameDateStandard();

                return mInstance;
            }
        }

        public int HourPerDay { get; set; }
        public int MinutePerHour { get; set; }
        public int SecondPerMinute { get; set; }
        public int MillisPerSecond { get; set; }
        public long TicksPerMillisecond { get; set; }

        public int[] DaysToMonth { get; set; }

        public int MaxYear { get; set; }
        public int DayPerWeek { get; set; }

        public int DayPerYear { get { return DaysToMonth[DaysToMonth.Length - 1]; } }
        public int MonthPerYear { get { return DaysToMonth.Length - 1; } }

        public int MaxMonth { get { return MaxYear * MonthPerYear; } }

        public int MillisPerMinute { get { return SecondPerMinute * MillisPerSecond; } }
        public int MillisPerHour { get { return MinutePerHour * MillisPerMinute; } }
        public int MillisPerDay { get { return HourPerDay * MillisPerHour; } }

        public long TicksPerSecond { get { return MillisPerSecond * TicksPerMillisecond; } }
        public long TicksPerMinute { get { return SecondPerMinute * TicksPerSecond; } }
        public long TicksPerHour { get { return MinutePerHour * TicksPerMinute; } }
        public long TicksPerDay { get { return HourPerDay * TicksPerHour; } }


        private GameDateStandard()
        {
            DayPerWeek = 7;
            HourPerDay = 24;
            MinutePerHour = 60;
            SecondPerMinute = 60;
            MillisPerSecond = 1000;
            TicksPerMillisecond = 10000L;

            MaxYear = 10000;

            DaysToMonth = new int[]
            {
                0,
                28,//Jan
                28+28,//Feb
                56+28,//May
                84+28,//April
                //120+31,//May
                //151+30,//June
                //181+31,//July
                //212+31,//Aug
                //243+30,//Sep
                //273+31,//Oct
                //304+30,//Nov
                //334+31,//Dec
            };
        }
    }
}
